package pp.infrastructure.util;

import cn.hutool.core.util.IdUtil;
import pp.infrastructure.exception.PPException;
import pp.infrastructure.exception.PPExceptionInfo;

public class IdGenerateUtil {

    /**
     * 雪花算法生成随机ID
     * @return 随机ID序列
     */
    public static Long nextId() {
         try {
             return IdUtil.getSnowflake().nextId();
         } catch (RuntimeException e) {
             throw new PPException(PPExceptionInfo.GENERIC_SYSTEM_FAIL);
         }
    }
}
